package com.teamwings.modules.track.controller;


import com.teamwings.common.vo.Result;
import com.teamwings.modules.track.service.IOatAppTrackService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author admin
 * @since 2022-01-19
 */
@RestController
@Api(tags = "办文跟踪")
@RequestMapping("/form/track")
public class OatAppTrackController {

    @Autowired
    private IOatAppTrackService oatAppTrackService;


    /**
     * 保存办文跟踪
     * @param instId 实例id
     * @param userId 用户id
     * @return
     */
    @PostMapping(value = "/save")
    public Result<?> save(
            @RequestParam("instId") String instId,
            @RequestParam("userId") String userId
    ) {
        oatAppTrackService.save(instId, userId);
        return Result.OK("保存数据成功！");
    }

    /**
     * 删除办文跟踪
     * @param instId 实例id
     * @param userId 用户id
     * @return
     */
    @PostMapping(value = "/deleteByInstIdAndUserId")
    public Result<?> deleteByInstIdAndUserId(
            @RequestParam("instId") String instId,
            @RequestParam("userId") String userId
    ) {
        oatAppTrackService.updateStateByInstIdAndUserId(instId, userId,1);
        return Result.OK("删除数据成功！");
    }


}



